﻿import QtQuick 2.0
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1
Item
{
    id:root
    width:abstracValue.width+data.width+addValue.width
    height:data.height
    property int opacityData:20

   Rectangle
   {
       id:abstracValue
       width:abstbutton.width
       height:abstbutton.height
       anchors.left: parent.left
       color:"transparent"
       anchors.verticalCenter: parent.verticalCenter
       Image
       {
          id:abstbutton
          anchors.centerIn: parent
          source:"./切图/设置/减少.png"
        }

    }
   Rectangle
   {
       id:data
       width:dataBg.width
       height:dataBg.height
       color:"transparent"
       anchors.left: abstracValue.right
       anchors.verticalCenter: parent.verticalCenter
       Image
       {
           id:dataBg
           anchors.centerIn: parent
           source:"./切图/设置/数字框.png"

       }

       TextInput
       {
           id:showdata
           width:dataBg.width
           height:dataBg.height
           text:opacityData+"%"
           color:"white"
           readOnly: false
           font.pixelSize:16
           anchors.verticalCenter: dataBg.verticalCenter
           anchors.left:dataBg.left
           anchors.leftMargin:10

       }

   }
   Rectangle
   {
       id:addValue
       width:addbutton.width
       height:addbutton.height
       anchors.left: data.right
       color:"transparent"
       anchors.verticalCenter: parent.verticalCenter
       Image
       {
           id:addbutton
           anchors.centerIn: parent
           source:"./切图/设置/增加.png"

       }
   }
    onOpacityDataChanged:
    {
       if(opacityData===100)
       {
           addbutton.source="./切图/设置/增加无法点击.png"
       }
       else if(opacityData===0)
       {
          abstbutton.source="./切图/设置/减少无法点击.png"
       }
       else
       {
           addbutton.source="./切图/设置/增加.png"
           abstbutton.source="./切图/设置/减少.png"
       }
    }

   MouseArea
   {
      anchors.fill:addValue
      onPressed:
      {
          addbutton.source=(opacityData==100)?"./切图/设置/增加无法点击.png":"./切图/设置/增加点击.png"

      }
      onReleased:
      {
           addbutton.source=(opacityData==100)?"./切图/设置/增加无法点击.png":"./切图/设置/增加.png"
      }

      onClicked:
      {
          if(opacityData<100)
          {
          opacityData+=1
          }
          else
          {
              opacityData=100
          }
      }


   }
   MouseArea
   {
      anchors.fill:abstracValue
      onPressed:
      {
          abstbutton.source=(opacityData===0)?"./切图/设置/减少无法点击.png":"./切图/设置/减少点击.png"
      }
      onReleased:
      {
          abstbutton.source=(opacityData===0)?"./切图/设置/减少无法点击.png":"./切图/设置/减少.png"
      }

      onClicked:
      {
          if(opacityData>0)
          {
          opacityData-=1
          }
          else
          {
           opacityData=0

          }
      }


   }

}

